package com.spring.shops.dao;

import com.spring.shops.model.entity.TzProdPropValue;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface TzProdPropValueMapper {
    int deleteByPrimaryKey(Long valueId);

    int insert(TzProdPropValue record);

    int insertSelective(TzProdPropValue record);

    TzProdPropValue selectByPrimaryKey(Long valueId);

    int updateByPrimaryKeySelective(TzProdPropValue record);

    int updateByPrimaryKey(TzProdPropValue record);
    /**
     * 根据产品属性id获取产品属性的所有值
     * @param specId
     */
    @Select("select * from yami_shops.tz_prod_prop_value where prop_id=#{specId}")
    List<TzProdPropValue> getSpecValuesByPropId(Integer specId);
    /**
     * 根据产品属性所有值的最大值id
     * @param
     */
    @Select("select max(value_id) from tz_prod_prop_value")
    Long maxValueId();
    @Select("select * from tz_prod_prop_value where prop_id=#{propId}")
    List<TzProdPropValue> selectByPropId(Long propId);

    void insertPropValues(Long propId, List<TzProdPropValue> prodPropValues);
    @Delete("delete from tz_prod_prop_value where prop_id=#{propId}")
    void deleteByPropId(Long propId);
    @Select("select * from tz_prod_prop_value where prop_id=#{specId}")
    TzProdPropValue selectAllById(Long specId);
}